package com.mycloud.message;

import com.mycloud.dto.OrderDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;

/**
 * Created by PC on 2019/1/13.
 */
@Slf4j
@Component
@EnableBinding(StreamClient.class)
public class StreamReceiver {

//    @StreamListener(StreamClient.INPUT)
//    public void proess(Object message) {
//        log.info("message={}", message);
//    }
/*
    @StreamListener(StreamClient.INPUT)
    @SendTo(StreamClient.INPUT2)
    public String receiveOrder(OrderDTO message) throws InterruptedException {
        Thread.sleep(100000);
        log.info("message={}", message.getOrderId());
        return "已收到";
    }

    @StreamListener(StreamClient.INPUT2)
    public void receiveOrder2(String message) {
        log.info("message={}", message);
    }*/

/*    @StreamListener(StreamClient.OUTPUT2)
    public void process(OrderDTO msg){
        log.info("msg="+msg);
    }*/
}
